<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>重庆大学硕士研究生服务系统</title>
<?php $this->load->view('includes/ga_head'); ?>  
</head>
<!--[if lt IE 7 ]> <body class="ie ie6"> <![endif]-->
<!--[if IE 7 ]> <body class="ie ie7 "> <![endif]-->
<!--[if IE 8 ]> <body class="ie ie8 "> <![endif]-->
<!--[if IE 9 ]> <body class="ie ie9 "> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> 
<body class=""> 
<!--<![endif]-->
<?php $this->load->view('includes/ga_navbar'); ?>  
<?php $this->load->view('includes/ga_sidebar'); ?>  
<div class="content">
    <div class="header">
        <h1 class="page-title">公告信息</h1>
    </div>
    <ul class="breadcrumb">
        <li><a href="index.html">Home</a> <span class="divider">/</span></li>
        <li class="active">公告审批查询</li>
    </ul>

    <div class="container-fluid">
        <div class="row-fluid">
<?php $this->load->view('includes/ga_message'); ?>  
<?php echo form_open(current_url());	?>
<div class="row-fluid">
  <div class="span12">
   标题关键字：
   <input type="text" class="span2 search-query" name="search_key_words" value="<?php echo $search_key_words; ?>">
   审核状态：
   <select name="select_news_status" class="span2 search-query">
  	<option value="all">所有</option>
   	<?php foreach ($newsStatusInfo as $newsli) { ?>
  	<option value = <?php echo $newsli[0]; ?> <?php echo ($newsli[0]==$select_news_status)?'selected':''; ?>><?php echo $newsli[1]; ?></option>
  	<?php } ?>
   </select>
  
   <input type="submit" class="btn" value="搜索" />
   <a class="btn" href="<?php echo $base_url; ?>gass_news/manage_public_news" style="margin-left:20px;">重设</a>
</div>
</div>


<?php echo form_close();?>	
<div class="well">
<?php $attributes = array('id' => 'news_list_form');echo form_open(current_url(), $attributes);?>  	
            <table class="table table-striped table-hover">
                <thead>
                    <tr>
        <th>状态</th>
		<th>公告标题</th>
		<th>上传者</th>
		<th>上传时间</th>
		<th>审核人</th>
		<th>审核时间</th>
		<?php if(!$this->flexi_auth->in_group('college teacher')){?>
		<th>操作</th>	
		<?php } ?>
		<th>删除</th>
                    </tr>
                </thead>
                <?php if (!empty($newsListInfo )) { ?>
                <tbody>
							<?php foreach ($newsListInfo as $news) { ?>
                    <tr>
<th><?php foreach ($newsStatusInfo as $nsi){
									          if ($nsi[0] == $news['news_status']){
									          	echo $nsi[1];
									          }
									            
									        }
								    ?>
								</th>
								<td>
									<?php echo $news['news_title'];?>
								</td>
								<td>
									<?php $userInfo = $this->flexi_auth->get_user_by_id($news['news_create_person'])->row_array();echo $userInfo['upro_first_name'].' '.$userInfo['upro_last_name'];?>
								</td>
								<td>
									<?php echo $news['create_time'];?>
								</td>
								<td>
									<?php if ($news['news_approval_person']==0){ echo '尚未审核';}
									      else { 
									      	$userInfo = $this->flexi_auth->get_user_by_id($news['news_approval_person'])->row_array();
									      	echo $userInfo['upro_first_name'].' '.$userInfo['upro_last_name'];
									      }
									?>
								</td>					
								<td>
									<?php echo $news['approval_time'];?>
								</td>
								<?php if(!$this->flexi_auth->in_group('college teacher')){?>
								<td><?php //如果审批通过了，就不需要预览与审批了
									  if ($news['news_status']==1){?>
									<a href="<?php echo $base_url;?>gass_news/public_news_details/<?php echo $news['news_id'] ?>">预览</a>
									&nbsp
									<a href="<?php echo $base_url;?>gass_news/public_news_authorization/<?php echo $news['news_id'] ?>">审批通过</a>
								<?php } ?>
								</td>
								<?php } ?>
								<td>
								<?php //对于二级招生单位而言，如果审批通过了，就不能删除了；但研招办依然可以删除
									if (($news['news_status']==1 && $this->flexi_auth->in_group('college teacher')) || $this->flexi_auth->in_group('admin teacher')){?>
									<input type="checkbox" name="delete_news[<?php echo $news['news_id'];?>]" value="1"/>
									<?php } ?>
								</td>
                    </tr>
                <?php } ?>
                </tbody>	<TFOOT>
      <TR>
 <TD colSpan=<?php echo ($this->flexi_auth->in_group('college teacher'))?"6":"7"; ?>><?php if (! empty($pagination['links'])) { ?>
                 	   总数: 共 <?php echo $pagination['total_public_news'];?> 条查询结果
                 	   链接: <?php echo $pagination['links'];?>
                 	   <?php } ?>
                 </TD> 
                 <td colSpan=1>
  <button type="submit" class="btn" id="del_btn" /><i class="icon-remove"></i> 删除公告 
  </button>
  <input type="hidden" value="1" name="update_news"/>
                 </td>
      </TR>
    </TFOOT>
            <?php } else { ?>
                <tbody>
                    <tr>
<td colspan=<?php echo ($this->flexi_auth->in_group('college teacher'))?"7":"8"; ?> class="highlight_red">
									没有任何提交审批的公告
								</td>
                    </tr>
                </tbody>
            <?php } ?>
            </table>
            <?php echo form_close();?>
                
</div>
<?php $this->load->view('includes/ga_footer'); ?>  
        </div>
    </div>
</div>
<?php $this->load->view('includes/ga_scripts'); ?>
<script>
/**
 * 对下拉菜单进行处理
 *
 * 不允许任何人选择状态一：尚未提交申请
 * 不允许专业学院老师选择状态二：研招办审核中
 */
$(document).ready(function(){
	jsRemoveItemFromSelect($("select")[0],1);
  <?php if($this->flexi_auth->get_user_group_id()==2){?>
  jsRemoveItemFromSelect($("select")[0],2);	
  jsRemoveItemFromSelect($("select")[0],5);	
  <?php }?>

    $('#del_btn').confirm({
		'title' : '删除公告',
		'message' : '您确定要删除该公告吗,请谨慎操作？!',        
		'action' : function() {
			$('#news_list_form').submit();
		}
	});
});

</script>  
  
</body>
</html>
